Skip to content

feat(cycle): rulesets reconcile cycle, repo + org (#9)#26

Merged
lex00 merged 1 commit into
mainfrom
feat/rulesets-cycle
Jun 19, 2026
Merged

feat(cycle): rulesets reconcile cycle, repo + org (#9)#26
lex00 merged 1 commit into
mainfrom
feat/rulesets-cycle

Conversation

@lex00

@lex00 lex00 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #9. Completes the npm-publish gate (#5#9).

Adds the rulesets cycle — repository and organization rulesets, a separate REST API from classic branch protection (which the branch-protection cycle already covers).

New types (rulesets weren't modeled before)

  • Config: RulesetConfig (+ RulesetTarget/RulesetEnforcement) on OrgConfig.rulesets and RepoConfig.rulesets. bypassActors/conditions/rules are GitHub-native pass-through JSON so the cycle forwards them verbatim.
  • Diff: LiveRuleset (carries the GitHub id, captured-not-diffed), diffRulesets for both org-ruleset and repo-ruleset resource types, added to RESOURCE_TYPE_ORDER. Deletes are ownership-gated like every managed collection.

Cycle

  • fetchLive: lists rulesets (paginated) then GETs each ruleset's detail so rules/conditions/bypassActors are populated for an accurate diff. Org rulesets via orgLogin; repo rulesets for scope.repos that declare them. 404 → empty (rulesets unsupported / repo missing).
  • apply: POST for creates; PUT/DELETE address the ruleset by its live id (read from the change-set before), with a clear error if the id is missing.

RMW note

A ruleset is authored as a unit — the declared rules/conditions/bypassActors are the source of truth for that ruleset; we don't merge individual rules from live. Selective-by-omission protects undeclared rulesets, which are never touched.

Verification

  • npx tsc --noEmit clean
  • npm test green (328 tests; +20 in rulesets.test.ts; existing diff tests unaffected)
  • Action bundle rebuilt for the CI freshness check

With this merged, all five access/repo cycles in the roadmap's npm-publish gate (#5 org-settings, #6 membership, #7 teams, #8 repo-settings, #9 rulesets) are landed.

🤖 Generated with Claude Code

Adds the rulesets API (separate from classic branch protection): new
RulesetConfig on OrgConfig/RepoConfig, LiveRuleset + diffRulesets in the
diff (org-ruleset/repo-ruleset resource types, ownership-gated deletes,
id captured-not-diffed), and the cycle. fetchLive lists + GETs detail
per ruleset; apply POSTs creates and addresses updates/deletes by live
id. Completes the npm-publish gate (#5-#9).

Registered, exported, action bundle rebuilt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00 lex00 merged commit 42c514c into main Jun 19, 2026
2 checks passed
@lex00 lex00 mentioned this pull request Jun 19, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cycle: rulesets (repo + org)

1 participant